package com.fanfanwang.ffw.app.net;

import java.lang.reflect.Type;

import org.json.JSONException;

import com.fanfanwang.ffw.app.bean.SucGetAppVersionBean;
import com.fanfanwang.ffw.app.bean.SucChksmsBean;
import com.fanfanwang.ffw.app.bean.SucGetCityListBean;
import com.fanfanwang.ffw.app.bean.SucGetDianListBean;
import com.fanfanwang.ffw.app.bean.SucGetLengthListBean;
import com.fanfanwang.ffw.app.bean.SucGetNewsInfoBean;
import com.fanfanwang.ffw.app.bean.SucGetNewsListBean;
import com.fanfanwang.ffw.app.bean.SucGetOrdersInfoBean;
import com.fanfanwang.ffw.app.bean.SucGetOrdersListBean;
import com.fanfanwang.ffw.app.bean.SucGetParkListBean;
import com.fanfanwang.ffw.app.bean.SucGetParkingInfoBean;
import com.fanfanwang.ffw.app.bean.SucGetUserInfoBean;
import com.fanfanwang.ffw.app.bean.SucGetYuYueListBean;
import com.fanfanwang.ffw.app.bean.SucGetparkingListBean;
import com.fanfanwang.ffw.app.bean.SucIsRegBean;
import com.fanfanwang.ffw.app.bean.SucIsRegReturnBean;
import com.fanfanwang.ffw.app.bean.SucLoginBean;
import com.fanfanwang.ffw.app.bean.SucOrderDoneBean;
import com.fanfanwang.ffw.app.bean.SucRegBean;
import com.fanfanwang.ffw.app.bean.SucSaveFeedbackBean;
import com.fanfanwang.ffw.app.bean.SucSetNewPasswordBean;
import com.fanfanwang.ffw.app.bean.SucSetPasswordBean;
import com.fanfanwang.ffw.app.bean.SucUpdateMobileBean;
import com.fanfanwang.ffw.app.bean.SucUpdateUserinfoBean;
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import com.google.gson.reflect.TypeToken;

import android.text.TextUtils;

public class FfwParse {

	/**
	 * 登陆解析
	 * 
	 * @param json
	 * @return
	 * @throws JSONException
	 */
	public static SucLoginBean parseLogin(String json) throws JSONException {
		Type type = new TypeToken<SucLoginBean>() {
		}.getType();
		SucLoginBean bean = new SucLoginBean();
		try {
			bean = new Gson().fromJson(json, type);
		} catch (JsonSyntaxException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return bean;
	}
	
	/**
	 * 用户注册解析
	 * 
	 * @param json
	 * @return
	 * @throws JSONException
	 */
	public static SucRegBean parseReg(String json) throws JSONException {
		Type type = new TypeToken<SucRegBean>() {
		}.getType();
		SucRegBean bean = new SucRegBean();
		try {
			bean = new Gson().fromJson(json, type);
		} catch (JsonSyntaxException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return bean;
	}
	/**
	 * 用户检测解析
	 * 
	 * @param json
	 * @return
	 * @throws JSONException
	 */
	public static SucIsRegBean parseIsReg(String json) throws JSONException {
		Type type = new TypeToken<SucIsRegBean>() {
		}.getType();
		SucIsRegBean bean = new SucIsRegBean();
		try {
			bean = new Gson().fromJson(json, type);
		} catch (JsonSyntaxException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return bean;
	}
	/**
	 * 找回密码用户检测解析
	 * 
	 * @param json
	 * @return
	 * @throws JSONException
	 */
	public static SucIsRegReturnBean parseIsRegReturn(String json) throws JSONException {
		Type type = new TypeToken<SucIsRegReturnBean>() {
		}.getType();
		SucIsRegReturnBean bean = new SucIsRegReturnBean();
		try {
			bean = new Gson().fromJson(json, type);
		} catch (JsonSyntaxException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return bean;
	}
	/**
	 * 短信验证码解析
	 * 
	 * @param json
	 * @return
	 * @throws JSONException
	 */
	public static SucChksmsBean parseChecksms(String json) throws JSONException {
		Type type = new TypeToken<SucChksmsBean>() {
		}.getType();
		SucChksmsBean bean = new SucChksmsBean();
		try {
			bean = new Gson().fromJson(json, type);
		} catch (JsonSyntaxException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return bean;
	}
	/**
	 * 修改用户手机号解析
	 * 
	 * @param json
	 * @return
	 * @throws JSONException
	 */
	public static SucUpdateMobileBean parseUpdateMobile(String json) throws JSONException {
		Type type = new TypeToken<SucUpdateMobileBean>() {
		}.getType();
		SucUpdateMobileBean bean = new SucUpdateMobileBean();
		try {
			bean = new Gson().fromJson(json, type);
		} catch (JsonSyntaxException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return bean;
	}
	
	/**
	 * 修改用户信息解析
	 * 
	 * @param json
	 * @return
	 * @throws JSONException
	 */
	public static SucUpdateUserinfoBean parseUpdateUserinfo(String json) throws JSONException {
		Type type = new TypeToken<SucUpdateUserinfoBean>() {
		}.getType();
		SucUpdateUserinfoBean bean = new SucUpdateUserinfoBean();
		try {
			bean = new Gson().fromJson(json, type);
		} catch (JsonSyntaxException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return bean;
	}
	/**
	 * vii.	getUserInfo获取用户基本资料解析
	 * 
	 * @param json
	 * @return
	 * @throws JSONException
	 */
	public static SucGetUserInfoBean parseGetUserInfo(String json) throws JSONException {
		Type type = new TypeToken<SucGetUserInfoBean>() {
		}.getType();
		SucGetUserInfoBean bean = new SucGetUserInfoBean();
		try {
			bean = new Gson().fromJson(json, type);
		} catch (JsonSyntaxException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return bean;
	}
	
	/**
	 * vii.	viii.	setPassword修改用户密码
	 * 
	 * @param json
	 * @return
	 * @throws JSONException
	 */
	public static SucSetPasswordBean parseSetPassword(String json) throws JSONException {
		Type type = new TypeToken<SucSetPasswordBean>() {
		}.getType();
		SucSetPasswordBean bean = new SucSetPasswordBean();
		try {
			bean = new Gson().fromJson(json, type);
		} catch (JsonSyntaxException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return bean;
	}
	
	/**
	 * ix.	setNewPassword设置用户新密码
	 * 
	 * @param json
	 * @return
	 * @throws JSONException
	 */
	public static SucSetNewPasswordBean parseSetNewPassword(String json) throws JSONException {
		Type type = new TypeToken<SucSetNewPasswordBean>() {
		}.getType();
		SucSetNewPasswordBean bean = new SucSetNewPasswordBean();
		try {
			bean = new Gson().fromJson(json, type);
		} catch (JsonSyntaxException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return bean;
	}
	
	/**
	 * x.	saveFeedback用户意见反馈
	 * 
	 * @param json
	 * @return
	 * @throws JSONException
	 */
	public static SucSaveFeedbackBean parseSaveFeedback(String json) throws JSONException {
		Type type = new TypeToken<SucSaveFeedbackBean>() {
		}.getType();
		SucSaveFeedbackBean bean = new SucSaveFeedbackBean();
		try {
			bean = new Gson().fromJson(json, type);
		} catch (JsonSyntaxException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return bean;
	}
	
	/**
	 * i.	getparkingList获取当前位置停车场数组
	 * 
	 * @param json
	 * @return
	 * @throws JSONException
	 */
	public static SucGetparkingListBean parseGetparkingList(String json) throws JSONException {
		Type type = new TypeToken<SucGetparkingListBean>() {
		}.getType();
		SucGetparkingListBean bean = new SucGetparkingListBean();
		try {
			bean = new Gson().fromJson(json, type);
		} catch (JsonSyntaxException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return bean;
	}
	
	/**
	 *ii.	getCityList获取区域列表
	 * 
	 * @param json
	 * @return
	 * @throws JSONException
	 */
	public static SucGetCityListBean parseCityList(String json) throws JSONException {
		Type type = new TypeToken<SucGetCityListBean>() {
		}.getType();
		SucGetCityListBean bean = new SucGetCityListBean();
		try {
			bean = new Gson().fromJson(json, type);
		} catch (JsonSyntaxException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return bean;
	}
	
	/**
	 *iii.	getLengthList获取搜索距离数组
	 * 
	 * @param json
	 * @return
	 * @throws JSONException
	 */
	public static SucGetLengthListBean parseGetLengthList(String json) throws JSONException {
		Type type = new TypeToken<SucGetLengthListBean>() {
		}.getType();
		SucGetLengthListBean bean = new SucGetLengthListBean();
		try {
			bean = new Gson().fromJson(json, type);
		} catch (JsonSyntaxException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return bean;
	}
	
	/**
	 *iv.	getParkList获取指定路段停车场列表
	 * 
	 * @param json
	 * @return
	 * @throws JSONException
	 */
	public static SucGetParkListBean parseGetParkList(String json) throws JSONException {
		Type type = new TypeToken<SucGetParkListBean>() {
		}.getType();
		SucGetParkListBean bean = new SucGetParkListBean();
		try {
			bean = new Gson().fromJson(json, type);
		} catch (JsonSyntaxException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return bean;
	}
	
	
	/**
	 *v.	getParkingInfo获取指定停车场详细信息
	 * 
	 * @param json
	 * @return
	 * @throws JSONException
	 */
	public static SucGetParkingInfoBean parseGetParkingInfo(String json) throws JSONException {
		Type type = new TypeToken<SucGetParkingInfoBean>() {
		}.getType();
		SucGetParkingInfoBean bean = new SucGetParkingInfoBean();
		try {
			bean = new Gson().fromJson(json, type);
		} catch (JsonSyntaxException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return bean;
	}
	
	
	/**
	 *vi.	getDianList获取洗车店、4S店、加油站列表
	 * 
	 * @param json
	 * @return
	 * @throws JSONException
	 */
	public static SucGetDianListBean parseGetDianList(String json) throws JSONException {
		Type type = new TypeToken<SucGetDianListBean>() {
		}.getType();
		SucGetDianListBean bean = new SucGetDianListBean();
		try {
			bean = new Gson().fromJson(json, type);
		} catch (JsonSyntaxException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return bean;
	}
	
	/**
	 *vii.	order_done预约停车位
	 * 
	 * @param json
	 * @return
	 * @throws JSONException
	 */
	public static SucOrderDoneBean parseOrderDone(String json) throws JSONException {
		Type type = new TypeToken<SucOrderDoneBean>() {
		}.getType();
		SucOrderDoneBean bean = new SucOrderDoneBean();
		try {
			bean = new Gson().fromJson(json, type);
		} catch (JsonSyntaxException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return bean;
	}
	
	/**
	 *viii.	getNewsList获取汽车资讯列表
	 * 
	 * @param json
	 * @return
	 * @throws JSONException
	 */
	public static SucGetNewsListBean parseGetNewsList(String json) throws JSONException {
		Type type = new TypeToken<SucGetNewsListBean>() {
		}.getType();
		SucGetNewsListBean bean = new SucGetNewsListBean();
		try {
			bean = new Gson().fromJson(json, type);
		} catch (JsonSyntaxException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return bean;
	}
	
	/**
	 *ix.	getNewsInfo获取汽车资讯详细信息
	 * 
	 * @param json
	 * @return
	 * @throws JSONException
	 */
	public static SucGetNewsInfoBean parseGetNewsInfo(String json) throws JSONException {
		Type type = new TypeToken<SucGetNewsInfoBean>() {
		}.getType();
		SucGetNewsInfoBean bean = new SucGetNewsInfoBean();
		try {
			bean = new Gson().fromJson(json, type);
		} catch (JsonSyntaxException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return bean;
	}
	
	
	/**
	 *i.	getOrdersList获取预约记录
	 * 
	 * @param json
	 * @return
	 * @throws JSONException
	 */
	public static SucGetOrdersListBean parseGetOrdersList(String json) throws JSONException {
		Type type = new TypeToken<SucGetOrdersListBean>() {
		}.getType();
		SucGetOrdersListBean bean = new SucGetOrdersListBean();
		try {
			bean = new Gson().fromJson(json, type);
		} catch (JsonSyntaxException e) {
			e.printStackTrace();
		}
		return bean;
	}
	
	/**
	 *i.	getOrdersList获取预约记录
	 * 
	 * @param json
	 * @return
	 * @throws JSONException
	 */
	public static SucGetOrdersInfoBean parseGetOrdersInfo(String json) throws JSONException {
		Type type = new TypeToken<SucGetOrdersInfoBean>() {
		}.getType();
		SucGetOrdersInfoBean bean = new SucGetOrdersInfoBean();
		try {
			bean = new Gson().fromJson(json, type);
		} catch (JsonSyntaxException e) {
			e.printStackTrace();
		}
		return bean;
	}
	/**
	 *ii.	getAppVersion获取手机版本信息
	 * 
	 * @param json
	 * @return
	 * @throws JSONException
	 */
	public static SucGetAppVersionBean parseGetAppVersion(String json) throws JSONException {
		Type type = new TypeToken<SucGetAppVersionBean>() {
		}.getType();
		SucGetAppVersionBean bean = new SucGetAppVersionBean();
		try {
			bean = new Gson().fromJson(json, type);
		} catch (JsonSyntaxException e) {
			e.printStackTrace();
		}
		return bean;
	}
	
	/**
	 * viii.	getYuyueList获取用户当天有效预约记录		
	 * 
	 * @param json
	 * @return
	 * @throws JSONException
	 */
	public static SucGetYuYueListBean parseGetYuyueList(String json) throws JSONException {
		Type type = new TypeToken<SucGetYuYueListBean>() {
		}.getType();
		SucGetYuYueListBean bean = new SucGetYuYueListBean();
		try {
			bean = new Gson().fromJson(json, type);
		} catch (JsonSyntaxException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return bean;
	}
	
}